package com.showcai.service.impl;

import com.showcai.dao.UserRelationMapper;
import com.showcai.dao.UserThirdMapper;
import com.showcai.module.UserRelation;
import com.showcai.module.UserThird;
import com.showcai.service.ServiceBase;
import com.showcai.service.UserThirdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created by Baggio on 2018-9-11.
 */
@Service
public class UserThirdServiceImpl extends ServiceBase implements UserThirdService {
    @Autowired
    UserThirdMapper userThirdMapper;
    @Autowired
    UserRelationMapper userRelationMapper;

    @Override
    public UserThird modifyUserThird(UserThird userThird) {
        UserThird userThird1=selectUserThird(userThird);
        if ( userThird1== null) {
            userThird1=new UserThird();
         userThird1.setType(userThird.getType());
         userThird1.setThirdId(userThird.getThirdId());
            userThirdMapper.insertUserThird(userThird1);
        }
        return userThird1;
    }

    @Override
    public UserThird selectUserThird(UserThird userThird) {
        return userThirdMapper.selectUserThird(userThird);
    }

    @Override
    public void modifyUserRelation(UserRelation userRelation) {
        userRelationMapper.insertUserRelation(userRelation);
    }

    @Override
    public UserRelation selectUserRelation(UserRelation userRelation) {
        return null;
    }

    @Override
    public List<UserThird> userThirdList(Map<String, String> map) {
        return userThirdMapper.userThirdList(map);
    }
}
